import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import cesium from 'vite-plugin-cesium'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(), cesium()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    }
  },
  server: {
    host: true,
    proxy: {
      '/api': {
        target: 'http://192.168.0.104:8080', // 宋志涛
        changeOrigin: true, // 是否改变源地址
        rewrite: (path) => path.replace(new RegExp(`^/api`), '/') // 重写路径
      }
    }
  }
})
